define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    return {
        index: function () {
            Table.api.init({
                extend: {
                    index_url : 'zz_article/article_type/index' + location.search,
                    add_url   : 'zz_article/article_type/add',
                    edit_url  : 'zz_article/article_type/edit',
                    del_url   : 'zz_article/article_type/del',
                    multi_url : 'zz_article/article_type/multi',
                    import_url: 'zz_article/article_type/import',
                    table     : 'zz_article_type',
                }
            });
            var table = $("#table")
            table.bootstrapTable({
                url     : $.fn.bootstrapTable.defaults.extend.index_url,
                pk      : 'id',
                sortName: 'id',
                columns : [
                    [
                        {checkbox: true},
                        {field: 'id', title: 'id'},
                        {field: 'status', title: '状态', searchList: Config.searchList.status, formatter: Table.api.formatter.normal},
                        {field: 'name', title: '名称', operate: 'like'},
                        {field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            })
            Table.api.bindevent(table);
        },
        add  : function () {
            Form.api.bindevent($("form[role=form]"))
        },
        edit : function () {
            Form.api.bindevent($("form[role=form]"))
        }
    }
})
